package com.bh.oss.exception;

import org.apache.commons.fileupload.FileUploadException;

import java.util.Arrays;

/**
 *
 */
@SuppressWarnings("serial")
public class OssInvalidExtensionException extends FileUploadException {

    private String[] allowedExtension;
    private String extension;
    private String filename;

    public OssInvalidExtensionException(String[] allowedExtension, String extension, String filename) {
        super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : ["
                + Arrays.toString(allowedExtension) + "]");
        this.allowedExtension = allowedExtension;
        this.extension = extension;
        this.filename = filename;
    }

    public String[] getAllowedExtension() {
        return allowedExtension;
    }

    public String getExtension() {
        return extension;
    }

    public String getFilename() {
        return filename;
    }

    public static class OssInvalidImageExtensionException extends OssInvalidExtensionException {
        public OssInvalidImageExtensionException(String[] allowedExtension, String extension, String filename) {
            super(allowedExtension, extension, filename);
        }
    }

    public static class OssInvalidFlashExtensionException extends OssInvalidExtensionException {
        public OssInvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) {
            super(allowedExtension, extension, filename);
        }
    }

    public static class OssInvalidMediaExtensionException extends OssInvalidExtensionException {
        public OssInvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) {
            super(allowedExtension, extension, filename);
        }
    }

}
